import request from '@/utils/request';

// 发送好友请求
export function sendFriendRequest(userId, friendId) {
  return request({
    url: '/api/friendship/request',
    method: 'post',
    params: { userId, friendId }
  });
}

// 接受好友请求
export function acceptFriendRequest(userId, requestId) {
  return request({
    url: '/api/friendship/accept',
    method: 'post',
    params: { userId, requestId }
  });
}

// 拒绝好友请求
export function rejectFriendRequest(userId, requestId) {
  return request({
    url: '/api/friendship/reject',
    method: 'post',
    params: { userId, requestId }
  });
}

// 删除好友
export function deleteFriend(userId, friendId) {
  return request({
    url: '/api/friendship',
    method: 'delete',
    params: { userId, friendId }
  });
}

// 获取用户的好友列表
export function getUserFriends(userId) {
  return request({
    url: '/api/friendship/friends',
    method: 'get',
    params: { userId }
  });
}

// 获取用户收到的好友请求
export function getFriendRequests(userId) {
  return request({
    url: '/api/friendship/requests',
    method: 'get',
    params: { userId }
  });
}

// 检查是否是好友关系
export function checkFriendship(userId, friendId) {
  return request({
    url: '/api/friendship/check',
    method: 'get',
    params: { userId, friendId }
  });
} 